package com.cweb.admin.configuration.database;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * 自定义数据库源切换
 */
public class DynamicRoutingDataSource extends AbstractRoutingDataSource {
    private static final Log log = LogFactory.get();

    /**
     * 多数据库源切换时，取得关键字
     */
    @Override
    protected Object determineCurrentLookupKey() {
        return DynamicDataSourceContextHolder.getDataSourceKey();
    }
}
        